<?php
Class HdAction extends Action{
	public function index(){
		$condition['pubtype']=array('gt',1);
		import('ORG.Util.EditPage');
		$count = M('Event')->where($condition)->count();
		$Page = new Page($count,10);
        $Page->setConfig('theme',"<ul class='pagination'><li><a>%totalRow% %header% %nowPage%/%totalPage% 页</a></li><li>%upPage%</li><li>%first%</li><li>%prePage%</li><li>%linkPage%</li><li>%nextPage%</li><li>%end%</li><li>%downPage%</li>".$gopagenu."</ul>");
		$this->page = $Page->show();
        $this->BL =  M('Event')->where($condition)->order("pubtime desc")->limit($Page->firstRow.','.$Page->listRows)->select();
        $this->currentpage = $Page->firstRow + 1; 	
        $this->display();
	}

	public function check(){
		$condition['id']=I('id');
		$data['ispass']=1;
		$data['pubtype']=2;
		$save = M('Event')->where($condition)->save($data);
		if($save !== false){
			$json['status']=1;
		}else{
			$json['status']=0;
		}
		$this->ajaxReturn($json,"JSON");
	}

	public function ban(){
		$condition['id']=I('id');
		$data['ispass']=1;
		$data['pubtype']=3;
		$data['masktime']=time();
		$save = M('Event')->where($condition)->save($data);
		if($save !== false){
			$json['status']=1;
		}else{
			$json['status']=0;
		}
		$this->ajaxReturn($json,"JSON");
	}
}